import request from "@/api";
import { IApiTranslate } from "@/types/translate";

// 单文本翻译
export function postTranslate({ src_lang, src_text, target_lang }: IApiTranslate) {
  if (!src_text) {
    return new Promise((resolve) => {
      resolve("");
    });
  }
  return request({
    url: "/translation/text",
    method: "post",
    data: {
      src_text,
      src_language_type: src_lang,
      tgt_language_type: target_lang,
    },
  });
}
